<template>
  <div>
    <el-table v-loading.body="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
      <el-table-column prop="id" label="id" min-width="60" align="center" ></el-table-column>
      <el-table-column prop="title" label="名称" min-width="60" align="center" ></el-table-column>
      <el-table-column prop="shortname" label="别称" min-width="60" align="center" ></el-table-column>
      <el-table-column prop="code" label="编号" min-width="60" align="center" ></el-table-column>
      <el-table-column prop="weblink" label="weblink" min-width="60" align="center" ></el-table-column>
      <el-table-column prop="level" label="级别" min-width="40" align="center" ></el-table-column>
      <el-table-column class-name="status-col" label="状态" width="110">
        <template slot-scope="scope">
          <el-tag :type="scope.row.status | statusName">{{ scope.row.status|statusName }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="type" label="type" min-width="40" align="center" ></el-table-column>
      <el-table-column prop="subtype" label="subtype" min-width="40" align="center" ></el-table-column>
      <el-table-column prop="solutionSp" label="解决方案" min-width="40" align="center" ></el-table-column>
      <el-table-column prop="titleSp" label="titleSp" min-width="40" align="center" ></el-table-column>
      <el-table-column prop="fdescSp" label="fdescSp" min-width="40" align="center" ></el-table-column>

      <!--<el-table-column align="center" label="操作" width="120">
        <template slot-scope="scope">
          <router-link :to="'/faultcode/detail?id='+scope.row.id">
            <el-button type="text" size="small" icon="el-icon-edit">详情</el-button>
          </router-link>
        </template>
      </el-table-column>-->
    </el-table>

  </div>

</template>

<script>
import {roomList} from "../../api/room";
import {faultcodeList} from "../../api/faultcode";

export default {
  name: "list",
  filters: {
    statusName(status) {
      if (status===1) {
        return '正常';
      }else{
        return '异常'
      }
    }
  },
  data() {
    return {
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 10
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      faultcodeList(this.listQuery).then(response => {
        this.list = response.data.data
        this.total = response.data.count
        this.listLoading = false
      })
    },
    handleSizeChange(val) {
      this.listQuery.limit = val
      this.listQuery.page = 1
      this.getList()
    },
    handleCurrentChange(val) {
      this.listQuery.page = val
      this.getList()
    }
  }
}
</script>

<style scoped>

</style>
